
Program sndtest;

Label
  Loop;

Type
  TextString = String[42];

Var
  snd,freq,I: Integer;
  vol,Lbutton,Rbutton,Keypad,Joystick:
     Byte;
  ChrSet: array[1..6144] of Byte;
  Message: TextString;

{$I A:SOUND.PAS}
{$I A:CONTROL.PAS}
{$I A:BMPBASE.PAS}
{$I A:BMPTEXT.PAS}

begin
  BitmapInit;
  ScreenColor(1,1);
  Message := 'Sound Test';
  Text32(10,11,15,0,Message);
  For I := 1 to 2 do
     begin
        freq := 100;
        while freq <= 600 do
           begin
              Tone(1,freq,10);
              Delay(50);
              freq := freq + 10
           end;
        freq := 600;
        while freq >= 100 do
           begin
              Tone(1,freq,10);
              Delay(50);
              freq := freq - 10;
           end;
     end;
  SoundOff(1);
  for I := 15 downto 0 do
     begin
        Noise(6,I);
        Delay(200);
     end;
  SoundOff(4);
  Message := 'Joystick Test';
  ClrScr(0);
  Text32(10,10,15,0,Message);
  repeat
     Loop:
     Controller(2,Lbutton,Rbutton,
                Keypad,Joystick);
{    if (Lbutton = 0) and (Rbutton = 0)
        and (Keypad = 0) and (Joystick
        = 0) then
           goto Loop;  }
     case Joystick of
        1: Text32(12,15,7,0,'N');
        3: Text32(12,15,7,0,'NE');
        2: Text32(12,15,7,0,'E');
        6: Text32(12,15,7,0,'SE');
        4: Text32(12,15,7,0,'S');
        12: Text32(12,15,7,0,'SW');
        8: Text32(12,15,7,0,'W');
        9: Text32(12,15,7,0,'NW');
     end;
     if Rbutton = 64 then
        Text32(12,15,7,0,'R_Fire')
     else
        if Lbutton = 64 then
           Text32(12,15,7,0,'L_Fire');
     Delay(200);
     Text32(12,15,7,0,'       ');
  until GetKey = 32;
  ClrScr(0);
  Message := 'Keypad Test';
  Text32(10,11,15,0,Message);
  repeat
     Controller(2,Lbutton,Rbutton,
                Keypad,Joystick);
     case Keypad of
        5: Text32(12,15,7,0,'0');
        2: Text32(12,15,7,0,'1');
        8: Text32(12,15,7,0,'2');
        3: Text32(12,15,7,0,'3');
        13: Text32(12,15,7,0,'4');
        12: Text32(12,15,7,0,'5');
        1: Text32(12,15,7,0,'6');
        10: Text32(12,15,7,0,'7');
        14: Text32(12,15,7,0,'8');
        4: Text32(12,15,7,0,'9');
        9: Text32(12,15,7,0,'#');
        6: Text32(12,15,7,0,'*');
     end;
  until GetKey = 32;
  VDPinit;
end.


